import os

from flask import Flask

from controller.user import user
from controller.article import article

app = Flask(__name__)
# 启用session
app.config['SECRET_KEY'] = os.urandom(24)

app.register_blueprint(user)
app.register_blueprint(article)


@app.errorhandler(404)
def page_not_found(error):
    print(error)
    return '输入的网址错误'


@app.errorhandler(500)
def service_error(error):
    print(error)
    return '服务端出错啦'


if __name__ == '__main__':
    app.run()
